/*
 * aqua-firefox-theme
 * button-fixes.css
 *
 * Copyright (c) 2019 Payson Wallach
 *
 * Released under the terms of the GNU General Public License, version 3
 * (https://gnu.org/licenses/gpl.html)
 */

@namespace xul "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";

/* overrides: Make the back button the same as other buttons */

:root:not([uidensity=compact]) #back-button {
  border-radius: var(--toolbarbutton-border-radius) !important;
}

:root:not([uidensity=compact]) #back-button>.toolbarbutton-icon {
  background-color: unset !important;
  border: unset !important;
  width: calc(2 * var(--toolbarbutton-inner-padding) + 16px) !important;
  height: calc(2 * var(--toolbarbutton-inner-padding) + 16px) !important;
  padding: var(--toolbarbutton-inner-padding) !important;
  border-radius: var(--toolbarbutton-border-radius);
  box-shadow: none !important;
}

:root:not([uidensity=compact]) #back-button:not([disabled]):not([open]):hover>.toolbarbutton-icon {
  background-color: var(--toolbarbutton-hover-background) !important;
  box-shadow: unset;
  border-color: unset;
}

:root:not([uidensity=compact]) #back-button[open]>.toolbarbutton-icon,
:root:not([uidensity=compact]) #back-button:not([disabled]):hover:active>.toolbarbutton-icon {
  background-color: var(--toolbarbutton-active-background) !important;
  border-color: unset;
}

/* remove header bar buttons' hover styles */
#nav-bar {
  --toolbarbutton-active-background: transparent !important;
  --toolbarbutton-hover-background: transparent !important;
}

/* glitch customizing: Cut / Copy / Paste buttons' icons
 * :not(#hack) is there just to elevate rule priority */
:root[customizing] #nav-bar>hbox toolbaritem toolbarbutton image:not(#hack) {
  opacity: 1 !important;
}

/* glitch customizing: Reload and Cut / Copy / Paste buttons */
:root:-moz-window-inactive[customizing] #nav-bar #stop-reload-button toolbarbutton,
:root:-moz-window-inactive[customizing] #nav-bar #edit-controls toolbarbutton {
  background-image: var(--aqua-inactive-button-background);
  box-shadow: var(--aqua-inactive-button-box-shadow);
}

/* glitch customizing: Reload and Cut / Copy / Paste buttons' icons */
:root:-moz-window-inactive[customizing] #nav-bar #stop-reload-button image.toolbarbutton-icon,
:root:-moz-window-inactive[customizing] #nav-bar #edit-controls image.toolbarbutton-icon {
  opacity: .7 !important;
}

/* glitch: Overflow and Burger buttons
 * :not(#hack) is there just to elevate rule priority */
:root[customizing] #nav-bar>toolbarbutton[disabled]:not(#hack),
:root[customizing] #nav-bar>toolbaritem>toolbarbutton[disabled]:not(#hack) {
  opacity: .5 !important;
}

/* glitch: Overflow button's icon */
:root[customizing] #nav-bar toolbarbutton:not(#urlbar-zoom-button)[disabled] image {
  fill-opacity: var(--toolbarbutton-icon-fill-opacity) !important;
}

/* bookmark buttons */
#nav-bar toolbarbutton.bookmark-item {
  width: auto !important;
}

#nav-bar toolbarbutton.bookmark-item .toolbarbutton-icon {
  margin-left: 6px;
}

#nav-bar toolbarbutton.bookmark-item .toolbarbutton-text {
  padding-right: 6px;
}

/* remove Burger button's left separator */
#PanelUI-button {
  border: 0 !important;
  margin: 0 !important;
  padding-inline-start: 0 !important;
}

/* fix library animation */

#library-animatable-box {
  --library-button-height: 46px !important;
  --library-icon-x: 1716px !important;
}

#library-button[animate]>.toolbarbutton-icon {
  fill: transparent !important;
}

/* fix toolbars close icons */

.close-icon:not(.tab-close-button) {
  list-style-image: url("moz-icon://stock/window-close-symbolic?size=dialog") !important;
}

.close-icon:not(.tab-close-button) image {
  filter: var(--aqua-window-icons-hack-filter) !important;
  height: 16px !important;
  width: 16px !important;
  margin: 6px !important;
}

#appMenu-popup .panel-banner-item[notificationid="update-restart"]::after {
  display: none !important;
}

/* identity site popover buttons */

.identity-popup-preferences-button:not(#hack) {
  list-style-image: url("chrome://browser/skin/settings.svg") !important;
}

#tracking-protection-preferences-button>.toolbarbutton-text {
  padding-inline-end: 0 !important;
}

/* fix findbar buttons issues */

.findbar-container .findbar-find-previous image,
.findbar-container .findbar-find-next image {
  margin: 6px !important;
  opacity: 1 !important;
}

.findbar-container toolbarbutton:focus {
  outline: 0 !important;
}

/* sidebar header button reset font size */
#sidebar-header {
  font-size: 1em !important;
}

/* sidebar header button arrow opacity */
#sidebar-switcher-arrow {
  opacity: 1 !important;
}

/* sidebar history view */
#viewButton {
  margin: 0 !important;
  margin-inline-start: 6px !important;
}

/* bookmarks editor buttons */

menulist {
  -moz-appearance: none !important;
}

.expander-down image,
.expander-up image {
  margin: 6px !important;
}
